|
|
|
| Build a Query 1. Click the View folder and then right-click to display the menu. Select the New View menu item. 2. Expand the Tables folder to display tables. 3. Grab the tblEmployees table and drop it into the Query Design window. 4. Grab the tblEmpTypes table and drop it into the Query Design window. 5. Set a relationship between the lEmpType_id field in the tblEmployees table and the lEmpType_id field in the tblEmpTypes table by dragging the lEmpType_id field in the tblEmployees table to the lEmpType_id field in the tblEmpTypes table. 6. Click sFirst_nm and szLast_nm in the tblEmployees table. 7. Click szEmployees_type in the tblEmpTypes table. 8. You now have a query complete with an inner join set between the two tables. 9. Click the close button in the upper-right corner of the form. 10. Respond by clicking Yes when asked to save the view. 11. Type in qryEmpTypes when prompted for a name for the view. |  | After saving the view, you should now be able to double-click the view to display a data sheet. (Note that this will only work if youre using the ODBC provider.) |
|
|
|
|
|
|
SQL Editor for Stored Procedures and Triggers |
|
|
|
|
|
|
|
|
When youre displaying the information in the Data View window, you have the option of viewing stored procedures. You can view the columns in the stored procedure as well. If you double-click the stored procedure, you can bring up the SQL Editor window for the stored procedure. Its in this window that you use the appropriate syntax to create a stored procedure on your target database. The SQL Editor is available only in the Enterprise Edition of Visual Basic. From within the SQL Editor window, you have the option of saving the stored procedure to the database, saving it to a local text file, or printing the stored procedure. Again, the option of saving to a local text file makes it easy for you to transfer this stored procedure to another SQL Server in the future. If you are using SQL Server, you can perform the following exercise. |
|
|
|
|
|